package cn.edu.bupt.msorder.controller;

import cn.edu.bupt.msorder.facade.InventoryFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/feign")
public class FeignDemoController {
    @Resource
    private InventoryFacade inventoryFacade;

    @GetMapping("/product/{product_uuid}/{num}")
    public String order(@PathVariable("product_uuid") String product_uuid,
                        @PathVariable("num") Integer num,
                        HttpServletRequest request){
        return inventoryFacade.deduct(product_uuid, num);
    }
}
